<template>
    <div class="box8">
        <div class="title">
            <p>数据统计</p>
            <img src="../../images/dataScreen-title.png" alt="">
        </div>
        <div class="charts" ref="charts">

        </div>
    </div>
</template>

<script lang="ts" setup name="Counter">
    import {ref,onMounted} from 'vue'
    import * as echarts from 'echarts'

    // 获取dom元素
    let charts=ref()

    // 组件挂载完毕
    onMounted(()=>{
        // 一个容器可以同时展示多种类型的图像图表
        let mychart=echarts.init(charts.value)
        let option = {
            title: {
                text: '游客消费统计',
                textStyle:{
                    color:'white'
                }
            },
            radar: {
                // shape: 'circle',
                indicator: [
                { name: '消费', max: 6500 },
                { name: '好感度', max: 16000 },
                { name: '出行', max: 30000 },
                { name: '小吃', max: 38000 },
                { name: '爱好', max: 52000 },
                { name: '景点', max: 25000 }
                ]
            },
            series: [
                {
                name: 'Budget vs spending',
                type: 'radar',
                data: [
                    {
                    value: [4200, 3000, 20000, 35000, 50000, 18000],
                    name: '购物'
                    },
                    {
                    value: [5000, 14000, 28000, 26000, 42000, 21000],
                    name: '吃饭'
                    }
                ]
                }
            ]
        }
        // 设置配置项
        mychart.setOption(option) 
    })
</script>

<style scoped lang="scss">
    .box8{
        width: 100%;
        height: 100%;
        background: url(../../images/dataScreen-main-cb.png) no-repeat;
        background-size: 100% 100%;
        margin: 20px 0px;

        .title{
            p{
                color: white;
                font-size: 20px;
            }
        }

        .charts{
            height:calc(100% - 30px)
        }
    }
</style>